#include <iostream>
#include <sstream>
#include <string>
#include <tuple>



// 定义 to_string 函数
template<typename... Args>
std::string to_string(Args&&... args) {
    std::ostringstream oss;
    size_t count = sizeof...(args);
    size_t index = 0;
    ((oss << args << (index++ < count - 1 ? " " : "")), ...);
    return oss.str();
}

// 宏定义，用于生成 serialize 和 deserialize 函数
#define GENERATE_SERIALIZE_FUNCTIONS(t,args...) \
        friend std::ostream& operator<<(std::ostream& os, const t& p) { \
            size_t count = sizeof...(args);\
            size_t index = 0;\
            os<<"{";\
            return ((os << p.args << (index++ < count - 1 ? "," : "}")), ...);\
        }


// 使用宏生成 serialize 和 deserialize 函数
struct Person {
    std::string name;
    int age;

    GENERATE_SERIALIZE_FUNCTIONS(Person,name,age)
};

int main() {
    Person person;
    person.name = "Alice";
    person.age = 30;
    std::cout<<person<<std::endl;

    return 0;
}
